package com.zhm.demo.schedule;

import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.DefaultManagedTaskScheduler;
import org.springframework.scheduling.config.CronTask;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;

public class ScheduleTask {

    public static void main(String[] args) {
//        DefaultManagedTaskScheduler defaultManagedTaskScheduler = new DefaultManagedTaskScheduler();
        ScheduledTaskRegistrar scheduledTaskRegistrar = new ScheduledTaskRegistrar();
//        scheduledTaskRegistrar.setScheduler(defaultManagedTaskScheduler);
        scheduledTaskRegistrar.addCronTask(new CronTask(()->{
            System.out.println("123");
        },"0/1 * * * * ?"));
        scheduledTaskRegistrar.afterPropertiesSet();

        while (true){}
    }
}
